//
//  Utils.m
//  DuBai
//
//  Created by darktm on 14-3-13.
//  Copyright (c) 2014年 darktm. All rights reserved.
//

#import "Utils.h"

@implementation Utils

+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size
{
    CGRect rect = CGRectMake(0, 0, size.width, size.height);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
+(id)storyBoardWithId:(NSString *)iden{
    UIStoryboard *s = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController * vc = [s instantiateViewControllerWithIdentifier:iden];
    return vc;
}

+(void)saveToLocalPlistForValue:(id)value key:(NSString *)shortKey{
    [[NSUserDefaults standardUserDefaults] setValue:value forKeyPath:shortKey];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(id)valueForLocalPlist:(NSString *)shortkey{
    return [[NSUserDefaults standardUserDefaults] valueForKey:shortkey];
}

@end
